import 'package:fzcgx_app/network/http.dart';
import 'package:fzcgx_app/ui/base/base_view_model.dart';
import 'package:fzcgx_app/ui/my/address/model/address_model.dart';

class AddressViewModel extends BaseViewModel {
  List<AddressModel> models;
  AddressViewModel() {
    this.setState(ViewState.Loading);
  }
  void requestApi(){
    Http.instance.postList<AddressModel>('city/address-index', null,
        onSuccess: (data) {
      if (null != data) {
        this.models=data;
        this.setState(ViewState.Success);
      } else {
        this.models= List<AddressModel>();
        this.setState(ViewState.Success);
      }
    }, onError: (error) {
      this.setState(ViewState.Error);
    }, onFail: (fail) {
      this.setState(ViewState.Error);
    });
  }
}
